/*
 * @Date: 2020-02-13 18:50:31
 * @LastEditors: peng qiao
 * @LastEditTime: 2020-03-30 16:29:14
 */
import http from './Common/http.js'
import constant from '@/controller/constant.js'

export default {
  // 已绑定的房产查询
  community_user_house_user: async function (userId) {
    const res = await http.get(constant.BASE_URL + '/community/userHouse/user/'+userId)
    return res
  },
  // 社区列表
  community_community_get_all: async function () {
    const res = await http.get(constant.BASE_URL + '/community/community/getAll')
    return res
  },
  // 房屋详情
  community_house_by_id: async function (id) {
    const res = await http.get(constant.BASE_URL + '/community/house/'+id)
    return res
  },
  // 房屋详情
  community_house_by_user_id: async function (id) {
    const res = await http.get(constant.BASE_URL + '/community/userHouse/'+id)
    return res
  },
  // 房屋绑定
  community_user_house_bind: async function (data) {
    const res = await http.post(constant.BASE_URL + '/community/userHouse/bind/', data)
    return res
  },
  // 根据社区id查询小区列表
  community_neighborhood_region: async function (id) {
    const res = await http.get(constant.BASE_URL + '/community/neighborhood/region/'+id)
    return res
  },
  // 根据小区id查询房屋列表
  community_house_neighborhood: async function (id) {
    const res = await http.get(constant.BASE_URL + '/community/house/neighborhood/'+id)
    return res
  },
  // 根据小区id分页查询房屋列表
  community_house_neighborhood_page: async function (id,pageSize,currentPage) {
    const res = await http.get(constant.BASE_URL + `/community/house/neighborhood/${id}/${pageSize}/${currentPage}`)
    return res
  },
  // 根据小区id删除绑定关系
  community_user_house_unbind: async function (id) {
    const res = await http.delete(constant.BASE_URL + '/community/userHouse/'+id)
    return res
  },
}